<%--
  Created by IntelliJ IDEA.
  User: Ypl
  Date: 2022/10/8
  Time: 15:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page isELIgnored="false" contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="/js/jquery-1.12.4.js"></script>
</head>
<body>

<input type="button" onclick="testGet()" value="get">
<input type="button" onclick="testPost()" value="post">
<input type="button" onclick="testPut()" value="put">
<input type="button" onclick="testDelete()" value="delete">

</body>

<script>
    function testGet() {
        $.ajax({
            type: "get",
            url:"/test/2",
            success: function(data) {
                console.log(data);
            }
        });
    }
    function testPost() {
        $.ajax({
            type: "post",
            url:"/test",
            contentType:'application/json',
            data:"{\"id\":2, \"name\":\"zhangsan\", \"sex\":\"男\",\"score\": 88}",
            success: function(data) {
                console.log(data);
            }
        });
    }
    function testPut() {
        $.ajax({
            type: "put",
            url:"/test",
            contentType:'application/json',
            data:"{\"id\":2, \"name\":\"wanggoudan\", \"sex\":\"女\",\"score\": 120}",
            success: function(data) {
                console.log(data);
            }
        });
    }
    function testDelete() {
        $.ajax({
            type: "delete",
            url:"/test/1",
            success: function(data) {
                console.log(data);
            }
        });
    }


</script>
</html>
